Skip to content

Conversation

@SoryRawyer
Copy link
Member

@SoryRawyer SoryRawyer commented Jun 2, 2025

As I learn more about OpenRefine's codebase, I figured I could contribute a little bit of what I've learned about Butterfly to the documentation. I've been trying to figure out an appropriate scope for an initial section on Butterfly (e.g. is it worthwhile to go into how request routing works?) but in the end decided to provide a small starting point and get feedback from others on where additional documentation might be helpful.

@netlify
Copy link

netlify bot commented Jun 2, 2025

Deploy Preview for openrefine-website ready!

Name Link
🔨 Latest commit 4b152ce
🔍 Latest deploy log https://app.netlify.com/projects/openrefine-website/deploys/683e0d152b60a6000838450c
😎 Deploy Preview https://deploy-preview-460--openrefine-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoryRawyer
Copy link
Member Author

@Abbe98, @sunilnatraj, since both of you have worked on extensions, would you mind reading over this new bit of Butterfly documentation? I'd be interested in hearing if you find it useful, and/or if anything else would be useful to include here.

@SoryRawyer SoryRawyer marked this pull request as ready for review August 27, 2025 20:43
Copy link
Member

@tfmorris tfmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered these six month old comments from a review that I never submitted. Sorry!

The comment about "non-obvious conceptual stuff" probably needs expansion/explanation, but I'm going to submit this without further edits so it doesn't get pushed down on the stack again.

different architecture, where data is stored on disk by default and cached in memory if the project is small enough.

### Butterfly {#butterfly}
The functional extensibility of OpenRefine is provided by a fork of the [SIMILE Butterfly](https://github.com/OpenRefine/simile-butterfly) modular web application framework. With this framework, extensions are able to provide new functionality both in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The functional extensibility of OpenRefine is provided by a fork of the [SIMILE Butterfly](https://github.com/OpenRefine/simile-butterfly) modular web application framework. With this framework, extensions are able to provide new functionality both in the
The functional extensibility of OpenRefine is provided by a fork of the [MIT SIMILE Butterfly](https://github.com/OpenRefine/simile-butterfly) modular web application framework. With this framework, extensions are able to provide new functionality both in the

The functional extensibility of OpenRefine is provided by a fork of the [SIMILE Butterfly](https://github.com/OpenRefine/simile-butterfly) modular web application framework. With this framework, extensions are able to provide new functionality both in the
server- and client-side. A [list of known extensions](https://openrefine.org/extensions) is maintained on our website and we have [specific documentation for extension developers](technical-reference/writing-extensions.md).

Butterfly organizes back-end functionality using a collection of modules. The only module exposed by OpenRefine is the `core` module, which provides extension points for other modules to hook into.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Butterfly organizes back-end functionality using a collection of modules. The only module exposed by OpenRefine is the `core` module, which provides extension points for other modules to hook into.
Butterfly organizes back-end functionality using a collection of modules. The only module exposed by core OpenRefine (not including the bundled extensions) is the `core` module, which provides extension points for other modules to hook into. Butterfly modules can declare their dependencies using the `requires=` property in the `module/MOD-INFO/module.properties file.


Butterfly organizes back-end functionality using a collection of modules. The only module exposed by OpenRefine is the `core` module, which provides extension points for other modules to hook into.

Each module uses a JavaScript file named `controller.js` to connect different parts of the backend. Butterfly uses a JavaScript interpreter to run this and other provided JavaScript files to configure the back-end. Extensions rely on `controller.js`, and specifically an `init` method within that file, to leverage the aforementioned extension points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth explaining how the Javascript/Java "glue" works here (or at least point to the extension docs).

More generally some of the non-obvious conceptual stuff should receive a significant portion of the attention.


Each module uses a JavaScript file named `controller.js` to connect different parts of the backend. Butterfly uses a JavaScript interpreter to run this and other provided JavaScript files to configure the back-end. Extensions rely on `controller.js`, and specifically an `init` method within that file, to leverage the aforementioned extension points.

While Butterfly does allow for modules to manage their own API endpoints, extension modules typically register their endpoints through the form of commands. HTTP requests for those commands are then dispatched by the `core` module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True for HTTP commands, but there are many other extension registries for importers, exporters, GREL functions, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants